import { axios } from '@/utils/request'
// 概要统计-全局统计
function getGlobalSummaryData (query) {
  return axios({
    url: '/web-service/statistics/summary/global',
    method: 'get',
    params: query
  })
}
// 概要统计-关键指标-新建零件数
function getKeyIndicatorEcuCountData (query) {
  return axios({
    url: '/web-service/statistics/summary/KeyIndicator/newEcuCount',
    method: 'get',
    params: query
  })
}

// 概要统计-关键指标-新建任务
function getKeyIndicatorTaskCountData (query) {
  return axios({
    url: '/web-service/statistics/summary/KeyIndicator/newTaskCount',
    method: 'get',
    params: query
  })
}

// 概要统计-关键指标-新建版本
function getKeyIndicatorVersionCountData (query) {
  return axios({
    url: '/web-service/statistics/summary/KeyIndicator/newVersionCount',
    method: 'get',
    params: query
  })
}

// 概要统计-关键指标-升级车次
function getKeyIndicatorUpgradeVehicleCountData (query) {
  return axios({
    url: '/web-service/statistics/summary/KeyIndicator/upgradeVehicleCount',
    method: 'get',
    params: query
  })
}

// 项目统计-图表
function getProjectChartData (query) {
  return axios({
    url: '/web-service/chart',
    method: 'get',
    params: query
  })
}

// 项目统计-列表
function getProjectTableListData (query) {
  return axios({
    url: '/web-service/list',
    method: 'get',
    params: query
  })
}

// 概览-资源统计
function getResourceCountData (query) {
  return axios({
    url: '/web-service/statistics/summary/resource',
    method: 'get',
    params: query
  })
}

//概览-车辆动态统计
function countVehicleByUpgradeStatus (params) {
  return axios({
    url: `/web-service/dashboard/countVehicleByUpgradeStatus`,
    method: 'get',
    params
  })
}


// 任务统计-图表
function getTaskReportChartData (query) {
  return axios({
    url: '/web-service/task/report/taskStatistics/chart',
    method: 'get',
    params: query
  })
}

// 任务统计-详细列表
function getTaskReportListData (query) {
  return axios({
    url: '/web-service/task/report/taskStatistics/list',
    method: 'get',
    params: query
  })
}

// 获取任务统计列表中某一个任务升级列表
function getOneTaskReportListData (query) {
  return axios({
    url: '/web-service/task/report/taskStatistics/list/detail',
    method: 'get',
    params: query
  })
}

// 项目统计导出
function getProjectReport (query) {
  return axios({
    url: '/web-service/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 任务统计导出
function getTaskReport (query) {
  return axios({
    url: '/web-service/task/report/taskStatistics/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 升级监控查询
function upgradeMonitorList (query) {
  return axios({
    url: '/web-service/task/upgradeMonitor/list',
    method: 'get',
    params: query,
  })
}
// 升级监控查询-概览
function upgradeMonitorFailList (query) {
  return axios({
    url: '/web-service/task/upgradeMonitor/failList',
    method: 'get',
    params: query,
  })
}

// 升级监控某辆车某个批次ECU分页列表
function getOtaUpdateHisDetailList (data) {
  return axios({
    url: '/web-service/task/upgradeMonitor/getOtaUpdateHisDetailList',
    method: 'post',
    data
  })
}

// 升级监控列表导出
function exportUpgradeMonitor(query){
  return axios({
      url: '/web-service/task/upgradeMonitor/export',
      method: 'get',
      params: query,
      responseType: 'blob'

  })
}


// 升级监控-FOTA升级列表导出
function exportFOTAUpgradeList(query){
  return axios({
      url: '/web-service/task/upgradeMonitor/exportFotaUpgradeList',
      method: 'get',
      params: query,
      responseType: 'blob'

  })
}

// 升级监控查询
function upgradeMonitorDashboard (data) {
  return axios({
    url: '/task-service/task/upgradeMonitor/dashboard',
    method: 'post',
    data
  })
}

// dashboard-head
function getDataForDashBoard (data) {
  return axios({
    url: '/web-service/task/report/taskStatistics/dashboard',
    method: 'post',
    data
  })
}
// dashboard-head
function getDashboardHead (data) {
  return axios({
    url: `/web-service/dashboard/getDashboardHead/${data}`,
    method: 'get',
  })
}

// dashboard-top
function getTopHeadData (params) {
  return axios({
    url: '/web-service/dashboard/getTopHeadData',
    method: 'get',
    params
  })
}

// 获取多媒体集合
function getAllMediaVersionSet (query) {
  return axios({
    url: '/web-service/task/upgradeMonitor/getAllMediaVersionSet',
    method: 'get',
    params: query
  })
}

// 获取车型列表
function getModelNameList (data) {
  return axios({
    url: '/web-service/task/upgradeMonitor/getModelNameList',
    method: 'post',
    data
  })
}


function exportVehicles(query){
  return axios({
      url: '/web-service/vehicle/report/exportVehicles',
      method: 'get',
      params: query,
      responseType: 'blob'

  })
}


// 月度流量统计-图表
function getMonthlyFlowChart (query) {
  return axios({
    url: '/web-service/flow/report/statistics/month',
    method: 'get',
    params: query
  })
}
// 时段流量统计-图表
function getFlowChartByHour (query) {
  return axios({
    url: '/web-service/flow/report/statistics/hour',
    method: 'get',
    params: query
  })
}
// 流量统计导出
function exportFlowStasticsReport (query) {
  return axios({
    url: '/web-service/flow/report/statistics/month/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
// 流量明细导出
function exportFlowDetailReport (query) {
  return axios({
    url: '/web-service/flow/report/statistics/hour/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
// 流量上报-明细列表
function getFlowDetailReportList (query) {
  return axios({
    url: '/web-service/flow/report/detail',
    method: 'get',
    params: query
  })
}
// 流量上报-明细导出
function exportFlowReportExcel (query) {
  return axios({
    url: '/web-service/flow/report/detail/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
//用户增长-折线图
function getUserCountIncrease (data) {
  return axios({
    url: '/user-service/user/countUserIncreaseByRoleId',
    method: 'post',
    data
  })
}
//OTA车辆/台架数-折线图
function getOTACount (data) {
  return axios({
    url: '/web-service/vehicle/report/vehicleCountByCreateBy',
    method: 'post',
    data
  })
}
//任务数-折线图
function increaseTaskCount(data){
 return axios({
    url: '/task-service/task/countTaskIncreaseByRoleId',
    method: 'post',
    data
  })
}
//平台使用时长-折线图
function getUserOnlineTime(data){
 return axios({
    url: '/user-service/user/countUserOnlineByRoleId',
    method: 'post',
    data
  })
}
//OTA软件增长数-折线图
function getOTASoftwareCount (data) {
  return axios({
    url: '/software-service/version/resource/countSoftwareByRoleId',
    method: 'post',
    data
  })
}

export default {
  getGlobalSummaryData,
  getKeyIndicatorEcuCountData,
  getKeyIndicatorTaskCountData,
  getKeyIndicatorVersionCountData,
  getKeyIndicatorUpgradeVehicleCountData,
  getProjectChartData,
  getProjectTableListData,
  getResourceCountData,
  countVehicleByUpgradeStatus,
  getTaskReportChartData,
  getTaskReportListData,
  getOneTaskReportListData,
  getProjectReport,
  getTaskReport,
  upgradeMonitorList,
  upgradeMonitorFailList,
  getOtaUpdateHisDetailList,
  exportUpgradeMonitor,
  exportFOTAUpgradeList,
  upgradeMonitorDashboard,
  getDataForDashBoard,
  getDashboardHead,
  getTopHeadData,
  getAllMediaVersionSet,
  getModelNameList,
  exportVehicles,
  getMonthlyFlowChart,
  getFlowChartByHour,
  exportFlowStasticsReport,
  exportFlowDetailReport,
  getFlowDetailReportList,
  exportFlowReportExcel,
  getUserCountIncrease,
  getOTACount,
  increaseTaskCount,
  getUserOnlineTime,
  getOTASoftwareCount
}
